home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / bfd / netbsd.h < prev    next >
C/C++ Source or Header  |  1994-09-13  |  3KB  |  75 lines

  1. /* BFD back-end definitions used by all NetBSD targets.
  2.    Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  3.  
  4. This file is part of BFD, the Binary File Descriptor library.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /* ZMAGIC files never have the header in the text.  */
  22. #define    N_HEADER_IN_TEXT(x)    0
  23.  
  24. /* ZMAGIC files start at address 0.  This does not apply to QMAGIC.  */
  25. #define TEXT_START_ADDR 0
  26.  
  27. #define N_MAGIC(ex) \
  28.     ( (((ex).a_info)&0xffff0000) ? (((ex).a_info)&0xffff) : ((ex).a_info) )
  29. #define N_MACHTYPE(ex) \
  30.     ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info)>>16)&0x03ff) : 0 )
  31. # define N_FLAGS(ex) \
  32.     ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info)>>26)&0x3f) : 0 )
  33. #define N_SET_INFO(ex, mag,mid,flag) \
  34.     ( (ex).a_info = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
  35.     (((mag)&0xffff)) ) )
  36. #define N_SET_MAGIC(exec,magic) \
  37.   ((exec).a_info = (((exec).a_info & ~0xffff) | ((magic) & 0xffff)))
  38. #define N_SET_MACHTYPE(exec,machtype) \
  39.   ((exec).a_info = \
  40.    (((exec).a_info & ~(0x3ff<<16)) | (((machtype)&0xff) << 16)))
  41. #define N_SET_FLAGS(exec, flags) \
  42.   ((exec).a_info = ((exec).a_info & 0xffff) | (flags & 0xffff))
  43.  
  44. #include "bfd.h"
  45. #include "sysdep.h"
  46. #include "libbfd.h"
  47. #include "libaout.h"
  48.  
  49. #define N_GETMAGIC(ex) \
  50.     ( (((ex).a_info)&0xffff0000) ? (((ex).a_info)&0xffff) : ((ex).a_info))
  51. #define N_GETMAGIC2(ex) \
  52.     ( (((ex).a_info)&0xffff0000) ? (((ex).a_info)&0xffff) : \
  53.     (((ex).a_info) | 0x10000) )
  54.  
  55. #define N_TXTADDR(ex)    (N_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : __LDPGSZ)
  56. #define N_TXTOFF(ex) \
  57.     ( N_GETMAGIC2(ex)==ZMAGIC || N_GETMAGIC2(ex)==(QMAGIC|0x10000) ? \
  58.     0 : (N_GETMAGIC2(ex)==(ZMAGIC|0x10000) ? __LDPGSZ : EXEC_BYTES_SIZE ))
  59. #define N_ALIGN(ex,x) \
  60.     (N_MAGIC(ex) == ZMAGIC || N_MAGIC(ex) == QMAGIC ? \
  61.      ((x) + __LDPGSZ - 1) & ~(__LDPGSZ - 1) : (x))
  62. #define    N_DATADDR(ex) \
  63.     (N_GETMAGIC(ex) == OMAGIC ? N_TXTADDR(ex) + (ex).a_text : \
  64.         (N_TXTADDR(ex) + (ex).a_text + __LDPGSZ - 1) & ~(__LDPGSZ - 1))
  65.  
  66. /* Data segment offset. */
  67. #define    N_DATOFF(ex) \
  68.     N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text)
  69.  
  70. /* On NetBSD, the magic number is always in ntohl's "network" (big-endian)
  71.    format.  */
  72. #define SWAP_MAGIC(ext) bfd_getb32 (ext)
  73.  
  74. #include "aout-target.h"
  75.